home *** CD-ROM | disk | FTP | other *** search
Wrap
class MiniGames.JFS.JFSPatrick extends State { var oJelly; var nX; var nY; var sState; var mcRef; static var sSTATE_IDLE = "Idle"; static var aSTATES_TAKEHOOK = ["Hook1","Hook2","Hook3","Hook4","Hook5","Hook6","Hook7","Hook8","Hook9","Hook10","Hook11"]; static var aSTATES_IDLEHOOK = ["IdleHook1","IdleHook2","IdleHook3","IdleHook4","IdleHook5","IdleHook6","IdleHook7","IdleHook8","IdleHook9","IdleHook10","IdleHook11"]; static var aSTATES_REEL = ["Reel1","Reel2","Reel3","Reel4","Reel5","Reel6","Reel7","Reel8","Reel9","Reel10","Reel11"]; static var nNB_FISHERROD_SOUNDS = 4; static var nRANGE_DRAG = 50; static var nFRAME_REACT_JELLY = 2; static var nFRAME_DETACH_JELLY = 8; static var nDRAG_TIME = 7; function JFSPatrick(_mcRef) { super(_mcRef); this.oJelly = null; this.nX = 0; this.nY = 0; this.setState(MiniGames.JFS.JFSPatrick.sSTATE_IDLE); } function reel() { if(this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[0] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[1] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[2] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[3] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[4] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[5] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[6] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[7] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[8] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[9] || this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[10])))))))))) { this.setState(MiniGames.JFS.JFSPatrick.aSTATES_REEL[Number(this.oJelly.mcRef._name) - 1]); Controller.getRef().getSounds().playRandomSound(MiniGames.JFS.JFSPatrick.nNB_FISHERROD_SOUNDS,"Reel",Controller.nSFX_VOLUME); } } function takeHook(_oJelly) { if(this.sState == MiniGames.JFS.JFSPatrick.sSTATE_IDLE) { this.setState(MiniGames.JFS.JFSPatrick.aSTATES_TAKEHOOK[Number(_oJelly.mcRef._name) - 1]); Controller.getRef().getSounds().playRandomSound(CTRLGame.nNB_THROW_SOUNDS,"IceBall_Throwed",Controller.nSFX_VOLUME); this.oJelly = _oJelly; this.oJelly.removeEvent(); this.nX = this.mcRef._xmouse; this.nY = this.mcRef._ymouse; } } function remove() { var _loc2_ = this.mcRef._xmouse - this.nX; var _loc3_ = this.mcRef._ymouse - this.nY; if(Math.abs(_loc2_) > MiniGames.JFS.JFSPatrick.nRANGE_DRAG || Math.abs(_loc3_) > MiniGames.JFS.JFSPatrick.nRANGE_DRAG) { this.reel(); } } function manageReel() { if(this.mcRef.mcState._currentframe == MiniGames.JFS.JFSPatrick.nFRAME_REACT_JELLY) { this.oJelly.react(); } else if(this.mcRef.mcState._currentframe == MiniGames.JFS.JFSPatrick.nFRAME_DETACH_JELLY) { this.oJelly.leaveBus(); this.oJelly = null; } else if(this.stateFinished()) { this.setState(MiniGames.JFS.JFSPatrick.sSTATE_IDLE); } } function manageHook() { if(this.stateFinished()) { this.setState(MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[Number(this.oJelly.mcRef._name) - 1]); } } function Idle() { } function Hook1() { this.manageHook(); } function Hook2() { this.manageHook(); } function Hook3() { this.manageHook(); } function Hook4() { this.manageHook(); } function Hook5() { this.manageHook(); } function Hook6() { this.manageHook(); } function Hook7() { this.manageHook(); } function Hook8() { this.manageHook(); } function Hook9() { this.manageHook(); } function Hook10() { this.manageHook(); } function Hook11() { this.manageHook(); } function IdleHook1() { this.remove(); } function IdleHook2() { this.remove(); } function IdleHook3() { this.remove(); } function IdleHook4() { this.remove(); } function IdleHook5() { this.remove(); } function IdleHook6() { this.remove(); } function IdleHook7() { this.remove(); } function IdleHook8() { this.remove(); } function IdleHook9() { this.remove(); } function IdleHook10() { this.remove(); } function IdleHook11() { this.remove(); } function Reel1() { this.manageReel(); } function Reel2() { this.manageReel(); } function Reel3() { this.manageReel(); } function Reel4() { this.manageReel(); } function Reel5() { this.manageReel(); } function Reel6() { this.manageReel(); } function Reel7() { this.manageReel(); } function Reel8() { this.manageReel(); } function Reel9() { this.manageReel(); } function Reel10() { this.manageReel(); } function Reel11() { this.manageReel(); } }